package com.asofrucol.web;

import javax.faces.event.ActionEvent;

import org.primefaces.context.RequestContext;
import org.springframework.test.context.ContextConfiguration;

import com.asofrucol.dto.RuatDTO;
import com.asofrucol.service.UserOwnerService;

@ContextConfiguration(locations = "classpath:/META-INF/asofrucolBusinessContext.xml")
public class StepByStepController {

	// @Autowired
	private RuatDTO ruatBean;
	// @Autowired
	private UserOwnerService UserOwnerService;

	private int stepNumber;

	public void viewPersonalData(ActionEvent actionEvent) {
		System.out.println("viewPersonalData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 1;
		context.addCallbackParam("view", "personal_data.xhtml");
	}

	public void viewContactData(ActionEvent actionEvent) {
		System.out.println("viewContactData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 2;
		context.addCallbackParam("view", "contact_data.xhtml");
	}

	public void viewEconomicData(ActionEvent actionEvent) {
		System.out.println("viewEconomicData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 3;
		context.addCallbackParam("view", "economic_data.xhtml");
	}

	public void viewInnovationData(ActionEvent actionEvent) {
		System.out.println("viewInnovationData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 4;
		context.addCallbackParam("view", "innovation_data.xhtml");
	}

	public void viewAssociativityData(ActionEvent actionEvent) {
		System.out.println("viewAssociativityData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 5;
		context.addCallbackParam("view", "associativity_data.xhtml");
	}

	public void viewFarmData(ActionEvent actionEvent) {
		System.out.println("viewFarmData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 6;
		context.addCallbackParam("view", "farm_data.xhtml");
	}

	public void viewForestBusinessData(ActionEvent actionEvent) {
		System.out.println("viewForestBusinessData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 7;
		context.addCallbackParam("view", "forest_business_data.xhtml");
	}

	public void viewOwnershipLearningData(ActionEvent actionEvent) {
		System.out.println("viewOwnershipLearningData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 8;
		context.addCallbackParam("view", "ownership_learning_data.xhtml");
	}

	public void viewConfirmationData(ActionEvent actionEvent) {
		System.out.println("viewConfirmationData");
		RequestContext context = RequestContext.getCurrentInstance();
		// userOwnerServiceImpl.saveUserOwnerDTO();
		stepNumber = 9;
		context.addCallbackParam("view", "confirmation_data.xhtml");
	}

	public void saveUserOwnerData(ActionEvent actionEvent) {
		System.out.println("saveUserOwnerData");
		RequestContext context = RequestContext.getCurrentInstance();
		context.addCallbackParam("view", "result_data.xhtml");
	}

	public int getStepNumber() {
		return stepNumber;
	}

	public void setStepNumber(int stepNumber) {
		this.stepNumber = stepNumber;
	}

	public RuatDTO getRuatBean() {
		return ruatBean;
	}

	public void setRuatBean(RuatDTO ruatBean) {
		this.ruatBean = ruatBean;
	}

	public UserOwnerService getUserOwnerService() {
		return UserOwnerService;
	}

	public void setUserOwnerService(UserOwnerService userOwnerService) {
		UserOwnerService = userOwnerService;
	}

}
